package org.example.contoller;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.example.entity.Product;
import org.example.service.AliImgService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@Slf4j
@RequestMapping("/api/ali/goods")
@AllArgsConstructor
public class AliImgContoller {
    private final AliImgService aliImgService;
    @PostMapping("/addImg")
    public ResponseEntity<String> addImg(Product product) {
        return ResponseEntity.ok(aliImgService.addImg(product));
    }
    @PostMapping("/searchImage")
    public ResponseEntity<String> searchImage(@RequestParam("pic") String pic) {
        return ResponseEntity.ok(aliImgService.searchImage(pic));
    }
    @PostMapping("/deleteImage")
    public ResponseEntity<String> deleteImage(Product product) {
        return ResponseEntity.ok(aliImgService.deleteImage(product));
    }
}
